<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // async await
        function fn1(){
            return new Promise(function(resolve,reject){
                setTimeout(function(){
                    console.log("fn1");
                    resolve();
                },1000);
            });
        } 

        function fn2(){
            setTimeout(function(){
                console.log("fn2");
            },1000);
        }

        fn1().then(()=>{
            fn2();
        })

        async function fun(){
            await fn1();
            fn2();
        }
        fun();
    </script>
</body>
</html>